<?php
/**
 * Created by PhpStorm.
 * User: Webdd
 * Date: 15/4/28
 * Time: 下午3:21
 */
namespace Android\Model;

class TeacherModel extends BaseModel {


    public function login($teacher_id, $password) {
        $map['teacher_id'] = $teacher_id;
        $map['password'] = md5($password);
        $teacher = $this->where($map)->find();
        if (empty($teacher)) {
            return false;
        }
        return $teacher;
    }


    public function isExist($teacher_id) {
        $teacher = $this->where("teacher_id = '{$teacher_id}'")->find();
        if (empty($teacher)) {
            return false;
        }
        return true;
    }


    /**
     * 获取老师姓名
     *
     * @param $id
     * @return mixed
     */
    public function getTeacherName ($id) {
        return $this->where('id = '.$id)->getField('name');
    }


}